#ifndef __IIC_PERIPHERAL_H
#define __IIC_PERIPHERAL_H

#include "stdint.h"

#define HARD_IIC_CH0_PDMA_CH 3

typedef enum {
	HARD_IIC_CH0
} HardIICCHEnum;

void HardIICDeInit(HardIICCHEnum iicch, uint32_t speed);
void HardIICEnableInt(HardIICCHEnum iicch);
void HardIICDisableInt(HardIICCHEnum iicch);

void HardIICSendOneData(HardIICCHEnum iicch, uint8_t data);
uint8_t HardIICWriteOneByte(HardIICCHEnum iicch, uint8_t slAddr, uint8_t data);
uint32_t HardIICWriteByteArray(HardIICCHEnum iicch, uint8_t slAddr, uint8_t *data, uint16_t len);
uint8_t HardIICWriteOneReg(HardIICCHEnum iicch, uint8_t slAddr, uint8_t valAddr, uint8_t data);
uint32_t HardIICWriteArray(HardIICCHEnum iicch, uint8_t slAddr, uint8_t valAddr, uint8_t *data, uint16_t len);
uint8_t HardIICWrite16bitReg(HardIICCHEnum iicch, uint8_t slAddr, uint16_t valAddr, uint8_t data);
uint32_t HardIICWriteArrayTo16BitAddr(HardIICCHEnum iicch, uint8_t slAddr, uint16_t valAddr, uint8_t *data, uint16_t len);

uint8_t HardIICReadOneByte(HardIICCHEnum iicch, uint8_t slAddr);
uint32_t HardIICReadByteArray(HardIICCHEnum iicch, uint8_t slAddr, uint8_t *receive, uint16_t len);
uint8_t HardIICReadOneReg(HardIICCHEnum iicch, uint8_t slAddr, uint8_t valAddr);
uint32_t HardIICReadByteArrayOneReg(HardIICCHEnum iicch, uint8_t slAddr, uint8_t valAddr, uint8_t *receive, uint16_t len);
uint8_t HardIICReadByteOne16bitReg(HardIICCHEnum iicch, uint8_t slAddr, uint16_t valAddr);
uint32_t HardIICReadArrayOne16bitReg(HardIICCHEnum iicch, uint8_t slAddr, uint16_t valAddr, uint8_t *receive, uint16_t len);

void HardIICSendByteArrayPDMA(HardIICCHEnum iicch, uint8_t *data, uint16_t len);

uint8_t HardIICGetPDMAFinish(HardIICCHEnum iicch);

void HardIICCallbackInPDMAISR(HardIICCHEnum iicch);
void HardIICIRQHandle(HardIICCHEnum iicch);

#endif
